<template>
  <div class="pageBlock">
    <el-pagination
      align="center"
      background
      :layout="layout"
      :pager-count="pagerCount"
      :page-sizes="[5, 10, 15, 20]"
      :current-page="currentPage"
      :page-size="pageSize"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
export default {
  props: {
    total: {
      type: Number,
      default: 0
    },
    pageSize: {
      type: Number,
      default: 20
    },
    currentPage: {
      type: Number,
      default: 1
    },
    //
    pagerCount: {
      type: Number,
      default: 7
    },
    //
    layout: {
      type: String,
      default: 'total, sizes, prev, pager, next, jumper'
    }
  },
  data() {
    return {
      size: '',
      page: ''
    }
  },
  methods: {
    handleSizeChange(val) {
      this.size = val
      this.$emit('handleSizeChange', this.size)
    },
    handleCurrentChange(val) {
      this.page = val
      this.$emit('handleCurrentChange', this.page)
    }
  }
}
</script>

<style lang="scss" scope>
// 分页
.pageBlock {
  margin-top: 15px;
  .el-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    .el-pagination__total {
      color: #fff;
      font-size: 18px;
      font-weight: 400;
    }
    .el-pagination__sizes {
      .el-select {
        .el-input {
          .el-input__inner {
            font-size: 14px;
          }
          .el-select__caret {
            color: #001832;
          }
        }
      }
    }
    .el-pagination__jump {
      display: flex;
      align-items: center;
      color: #fff;
      font-size: 18px;
      font-weight: 400;
      .el-input {
        .el-input__inner {
          font-size: 18px;
        }
      }
    }
    button {
      height: 28px;
      width: 28px;
      background: transparent !important;
      border: 2px solid #ffffff;
      border-radius: 4px;
      .el-icon {
        font-size: 18px !important;
        font-weight: 400;
        color: #fff;
      }
    }
    ul {
      li {
        height: 32px;
        font-size: 16px;
        color: #fff !important;
        background: transparent !important;
        font-weight: 400;
        border: 2px solid #ffffff;
        border-radius: 4px;
      }
      .active {
        color: #001832 !important;
        background: #fff !important;
      }
    }
    .el-pager li{
      min-width: 32px !important;
    }
    .el-pager li.active + li {
      border: 2px solid #ffffff;
    }
  }
}
</style>
